Add flask.Markup XSS plugin#877
Conversation
|
I feel as if this should be not in core but a separate plugin that users can install |
|
Hi @sigmavirus24 , |
|
Considering But I would concur that it makes sense to add this plugin to bandit. I don't see why this should be separate, considering the existing plugins in core. That being said the implementation could be greatly improved. This rule is much too broad. It's always fine to pass a literal/uninterpolated string into |
|
@ericwb @lukehinds @sigmavirus24 As long as there's some interest, considering the precedent set by django/jinja/mako, I'd be happy to take a stab at an implementation for |
ericwb
left a comment
There was a problem hiding this comment.
Please add to the functional tests that verify this new plugin.
Co-authored-by: Eric Brown <ericwb@users.noreply.github.com>
Co-authored-by: Eric Brown <ericwb@users.noreply.github.com>
Co-authored-by: Eric Brown <ericwb@users.noreply.github.com>
There was a problem hiding this comment.
So it seems that Flask removed the deprecated Flask.markup. Flask advises to now use:
from markupsafe import Markup
Importing escape and Markup from flask is deprecated. Import them directly from markupsafe instead. [#4996](https://github.com/pallets/flask/pull/4996)
Ah, thanks! I guess this plugin is no longer needed in context of flask. I will close the PR. Let me know if you find it useful to have a separate plugin for usage of |
|
I can try to port the rule I wrote for ruff to bandit, if there's interest. https://docs.astral.sh/ruff/rules/unsafe-markup-use/ Either with or without the corresponding settings. I'm personally not a huge fan of the whitelist, but it was requested by the community. |
Hi,
I would like to contribute another plugin based on Flask's security consideration about calling
flask.Markupon user submitted data.Cheers!